<?php

class Users_Form_Signup extends Zend_Form {

    private $_translate = null;

    public function init() {
        $this->_translate = Zend_Registry::get('Zend_Translate');
        $this->setAction('/users/register')
                ->setMethod('post');

        //email
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel($this->_translate->_('email') . ':')
                ->setOptions(array('size' => '100', 'placeholder' => $this->_translate->_('email_placeholder'), 'class' => 'span12'))
                ->addFilter('StringToLower')
                ->setRequired(true)
                ->addValidator('EmailAddress')
                ->addErrorMessage("Enter valid email address....");

        //password
        $password1 = new Zend_Form_Element_Password('password1');
        $password1->setLabel($this->_translate->_('password') . ':')
                ->addValidator('StringLength', false, array(6))
                ->setOptions(array('placeholder' => $this->_translate->_('min_6_chars'), 'class' => 'span12'))
                ->setRequired(true);

        $password2 = new Zend_Form_Element_Password('password2');
        $password2->setLabel($this->_translate->_('confirm') . ' ' . $this->_translate->_('password') . ':')
                ->addValidator('StringLength', false, array(6))
                ->setOptions(array('placeholder' => $this->_translate->_('min_6_chars'), 'class' => 'span12'))
                ->setRequired(true);



        //submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel($this->_translate->_('sign_up'))
                ->setOptions(array('class' => 'submit'))
                ->setAttrib('class', 'btn btn-success');


        $this->addElements(array($email, $password1, $password2, $submit));
    }

}

